local function bind_keymap(bufopts)
  local lspbuf = vim.lsp.buf
  local keymap = vim.keymap

  -- ===================== lsp 去调用命令 start ===========================
  -- 跳转到实现
  -- keymap.set('n', 'gi', lspbuf.implementation, bufopts)
  -- keymap.set('n', 'gd', lspbuf.definition, bufopts)
  -- keymap.set('n', 'gD', lspbuf.declaration, bufopts)
  -- keymap.set('n', 'K', lspbuf.hover, bufopts)
  -- keymap.set("n", "grn", lspbuf.rename, bufopts)
  -- -- 查看引用的代码
  -- keymap.set('n', 'gr', lspbuf.references, bufopts)
  -- keymap.set('n', 'K', lspbuf.hover, bufopts)
  -- keymap.set('n', '<C-k>', lspbuf.signature_help, bufopts)
  -- keymap.set('n', '<space>wa', lspbuf.add_workspace_folder, bufopts)
  -- keymap.set('n', '<space>wr', lspbuf.remove_workspace_folder, bufopts)
  -- keymap.set('n', '<space>wl', function()
  --   print(vim.inspect(lspbuf.list_workspace_folders()))
  -- end, bufopts)
  -- keymap.set('n', '<space>D', lspbuf.type_definition, bufopts)
  -- keymap.set('n', '<space>rn', lspbuf.rename, bufopts)
  -- keymap.set({ 'n', 'v' }, '<space>ca', lspbuf.code_action, bufopts)
  -- ===================== lsp 去调用命令 end ===============================

  -- ===================== telescope 去调用命令 start =======================
  -- -- ctrl + q 退出
  local builtin = require("telescope.builtin")
  -- 查看引用的代码
  -- keymap.set('n', 'gr', builtin.lsp_references, bufopts)
  -- keymap.set('n', 'gi', builtin.lsp_implementations, bufopts)
  -- keymap.set('n', 'gd', builtin.lsp_definitions, bufopts)
  -- keymap.set("n", "'td", builtin.diagnostics, bufopts)
  -- ===================== lsp 去调用命令 end ===============================

  -- ===================== lspsaga 去调用命令 start ========================
  -- q 退出 ctrl+k
  -- 查看引用的代码
  keymap.set("n", "gf", "<cmd>Lspsaga finder<CR>", bufopts)
  -- goto
  keymap.set("n", "gd", "<cmd>Lspsaga goto_definition<CR>")
  -- show
  keymap.set("n", "gpd", "<cmd>Lspsaga peek_definition<CR>", bufopts)
  keymap.set({ "n", "v" }, "<leader>ca", "<cmd>Lspsaga code_action<CR>", bufopts)
  keymap.set("n", "grn", "<cmd>Lspsaga rename<CR>")
  keymap.set("n", "<leader>d", "<cmd>Lspsaga show_line_diagnostics<CR>", bufopts)
  -- keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", bufopts)
  keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", bufopts)
  keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", bufopts)
  keymap.set("n", "<leader>k", "<cmd>Lspsaga hover_doc<CR>", bufopts)
  keymap.set("n", "<leader>ot", "<cmd>Lspsaga outline<CR>", bufopts) -- 右侧文档的 map
  -- ===================== lspsaga 去调用命令 end ===========================
end

return {
  bind_keymap = bind_keymap
}
